{% extends "app_detail.jinja" %}


{% block tab_navigation %}
{% endblock tab_navigation %}

{%- block page_heading -%}
Update Application for {{ submission.get_full_name() }}
{%- endblock page_heading -%}

{%- block app_detail_contents -%}
<form class="application_edit_form" action="" method="POST" accept-charset="utf-8">
  {#
    Non field errors are not included here because they will be
    displayed as flash messages in the header.
  #}
  {% include "includes/csrf_field.jinja" %}
  
  {% block form_content %}
    {%- for field in existing_data_form.iter_fields() %}
      {%- if field.subfields %}
        {%- for subfield in field.subfields %}
          <input type="hidden" name="existing_{{ subfield.get_input_name() }}" value="{{ subfield.raw_input_value }}">
        {%- endfor %}
      {%- elif field.has_multiple_values %}
          {%- for value in field.get_current_value() %}
            <input type="hidden" name="existing_{{ field.get_input_name() }}" value="{{ value }}">
          {%- endfor %}
      {%- else %}
        <input type="hidden" name="existing_{{ field.get_input_name() }}" value="{{ field.raw_input_value }}">
      {%- endif %}
    {%- endfor %}
    {% for field in form.iter_fields() %}
      {{ field.render(
        label_override=field.get_display_label(),
        help_text_override=' ') }}
    {% endfor %}

  <p class="edit-notification__alert how_to_bg_warning bg-warning">
    We will notify the applicant and other partners who are working with this applicant about any changes that have been made.
  </p>

  <div class="form-submit_choices">
    <a href="{{ submission.get_absolute_url() }}" class="action-back btn">
      <span class="glyphicon glyphicon-arrow-left"></span>
      {{ _("Cancel changes") }}
    </a>

    <button type="submit">
    {%- block submit_button_label -%}
      Save changes
    {%- endblock submit_button_label -%}
    </button>
  </div>
  {% endblock form_content %}


</form>
{%- endblock app_detail_contents -%}

